/**
 * @class   wosh::interfaces::devices::JabberGloox
 * @brief   Standard interface of JabberGloox (device).
 *
 * @ingroup Interfaces
 * @see     wosh::devices::JabberGlooxBundle
 ****************************************************************************
 * @version 0.8.384 $Id: JabberGloox.h 2628 2010-06-08 23:30:40Z alex $
 * @author  Alessandro Polo
 ****************************************************************************/
/* Copyright (c) 2007-2010, WOSH - Wide Open Smart Home 
 * by Alessandro Polo - OpenSmartHome.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the OpenSmartHome.com WOSH nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY Alessandro Polo ''AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Alessandro Polo BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ****************************************************************************/

#ifndef __WOSH_Interfaces_Services_JabberGloox_H__
 #define __WOSH_Interfaces_Services_JabberGloox_H__

 #include <interfaces/Device.h>


namespace wosh {
 namespace interfaces {
  namespace devices {

 #define _JabberGloox_NAME							"JabberGloox"

 #define _JabberGloox_KEY_LibraryVersion			"LibraryVersion"

 #define _JabberGloox_KEY_ServerAddress				"ServerAddress"
 #define _JabberGloox_KEY_ServerPort				"ServerPort"
 #define _JabberGloox_KEY_ServerProxy				"ServerProxy"

 #define _JabberGloox_KEY_UserName					"UserName"
 #define _JabberGloox_KEY_UserPassword				"UserPassword"

 #define _JabberGloox_KEY_StatusMessage				"StatusMessage"
 #define _JabberGloox_DEFAULT_StatusMsg				"wosh"

 #define _JabberGloox_KEY_AcceptSubscription		"AcceptSubscription"
 #define _JabberGloox_KEY_AcceptUnSubscription		"AcceptUnSubscription"

 #define _JabberGloox_KEY_AutoReconnectMode			"AutoReconnectMode"
 #define _JabberGloox_DEFAULT_AutoReconnectMode		1
 #define _JabberGloox_KEY_AutoReconnectDelay		"AutoReconnectDelay"
 #define _JabberGloox_DEFAULT_AutoReconnectDelay	5 // in seconds
 #define _JabberGloox_KEY_AutoReconnectRetries		"AutoReconnectRetries"
 #define _JabberGloox_DEFAULT_AutoReconnectRetries	20

 #define _JabberGloox_KEY_UserAccountKey			"UserAccountKey"
 #define _JabberGloox_DEFAULT_UserAccountKey		"JabberAccount"

 #define _JabberGloox_KEY_DefaultProtocol			"DefaultProtocol"
 #define _JabberGloox_KEY_DefaultLanguage			"DefaultLanguage"
 #define _JabberGloox_KEY_DefaultTargetWoshUser		"DefaultTargetWoshUser"

 #define _JabberGloox_DEFAULT_ServerPort			5222
 #define _JabberGloox_DEFAULT_TargetUser			"wosh"
 #define _JabberGloox_DEFAULT_Language				"en_GB"
 #define _JabberGloox_DEFAULT_AcceptSubscription	true
 #define _JabberGloox_DEFAULT_AcceptUnSubscription	true

 #define _JabberGloox_METHOD_ContactAdd				"add"
 #define _JabberGloox_METHOD_ContactRemove			"del"
 #define _JabberGloox_METHOD_ContactSynch			"synch"

 #define _JabberGloox_Subscription_Unknown			0x0000
 #define _JabberGloox_Subscription_Subscribe		0x0010
 #define _JabberGloox_Subscription_Subscribed		0x0011
 #define _JabberGloox_Subscription_UnSubscribe		0x0100
 #define _JabberGloox_Subscription_UnSubscribed		0x0101


class JabberGloox : public virtual Device
 {
	WOSH_BUNDLE_INTERFACE("wosh::interfaces::devices::JabberGloox")


/** @name JabberGloox Interface - Getters
 * @{
 ******************************************************************************/
	public:
		/**
		 * @brief   Get server address
		 * @return  address as string
		 */
		virtual const std::string& getServerAddress() const = 0;

		/**
		 * @brief   Get server port
		 * @return  server port
		 */
		virtual int getServerPort() const = 0;

		/**
		 * @brief   Get account username
		 * @return  account username
		 */
		virtual const std::string& getAccountName() const = 0;

		/**
		 * @brief   Get priority
		 * @return  priority
		 */
		virtual int getPriority() const = 0;

//@}
/** @name JabberGloox Interface - Setters
 * @{
 ******************************************************************************/
	public:
		/**
		 * @brief   Set server address and port. Provided for convenience
		 * @param address [in] address of the server
		 * @param port [in] port of the server
		 * @return false when internal thread is running, true else
		 */
		virtual bool setServer( const std::string& address, int port ) = 0;

		/**
		 * @brief   Set server account name and password. Provided for convenience
		 * @param username [in] username used to log on the server
		 * @param password [in] username used to log on the server
		 * @return false when internal thread is running, true else
		 */
		virtual bool setAccount( const std::string& username, const std::string& password ) = 0;

		/**
		 * @brief   Set priority of the account (login)
		 * @param value [in] true to set auto-presence
		 * @return false when internal thread is running, true else
		 */
		virtual bool setPriority( int value ) = 0;

//@}
	public:
		virtual ~JabberGloox() { }

}; // class def

  }; // namespace devices
 }; // namespace interfaces
}; // namespace wosh

#endif //__WOSH_Interfaces_Services_JabberGloox_H__
